package com.smile.service.entity.services;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

@Data
@ToString
public class FlightTaskExecuteData implements Serializable {

    @JSONField(name = "flight_id")
    private String flightId;

    @JSONField(name = "multi_dock_task")
    private MultiDockTask multiDockTask;

    @Data
    @ToString
    public static class MultiDockTask {

        @JSONField(name = "dock_infos")
        private List<DockInfo> dockInfos;

        @JSONField(name = "wireless_link_topo")
        private WirelessLinkTopo wirelessLinkTopo;

        @Data
        @ToString
        public static class DockInfo {

            @JSONField(name = "alternate_land_point")
            private AlternateLandPoint alternateLandPoint;

            @Data
            @ToString
            public static class AlternateLandPoint {
                // 移除height字段（根据说明不存在）

                @JSONField(name = "is_configured")
                private Integer isConfigured;

                // 修正：float类型（按规范要求）
                @JSONField(name = "latitude")
                private Float latitude;

                // 修正：float类型（按规范要求）
                @JSONField(name = "longitude")
                private Float longitude;

                // 修正：float类型（按规范要求）
                @JSONField(name = "safe_land_height")
                private Float safeLandHeight;
            }

            @JSONField(name = "dock_type")
            private String dockType;

            // 修正：double类型（按规范要求）
            @JSONField(name = "heading")
            private Double heading;

            // 修正：double类型（按规范要求）
            @JSONField(name = "height")
            private Double height;

            @JSONField(name = "home_position_is_valid")
            private Integer homePositionIsValid;

            @JSONField(name = "index")
            private Integer index;

            // 修正：double类型（按规范要求）
            @JSONField(name = "latitude")
            private Double latitude;

            // 修正：double类型（按规范要求）
            @JSONField(name = "longitude")
            private Double longitude;

            @JSONField(name = "rtcm_info")
            private RtcmInfo rtcmInfo;

            @JSONField(name = "sn")
            private String sn;

            @Data
            @ToString
            public static class RtcmInfo {
                @JSONField(name = "host")
                private String host;

                @JSONField(name = "mount_point")
                private String mountPoint;

                @JSONField(name = "port")
                private String port;

                @JSONField(name = "rtcm_device_type")
                private Integer rtcmDeviceType;

                @JSONField(name = "source_type")
                private Integer sourceType;
            }
        }

        @Data
        @ToString
        public static class WirelessLinkTopo {

            @JSONField(name = "center_node")
            private CenterNode centerNode;

            @Data
            @ToString
            public static class CenterNode {
                @JSONField(name = "sdr_id")
                private Long sdrId;

                @JSONField(name = "sn")
                private String sn;
            }

            @JSONField(name = "leaf_nodes")
            private List<LeafNode> leafNodes;

            @Data
            @ToString
            public static class LeafNode {
                @JSONField(name = "control_source_index")
                private Integer controlSourceIndex;

                @JSONField(name = "sdr_id")
                private Long sdrId;

                @JSONField(name = "sn")
                private String sn;

//                @JSONField(name = "valid")
//                private Boolean valid;
            }

            @JSONField(name = "secret_code")
            private List<Integer> secretCode;
        }
    }
}